<?php
namespace app\library\validate;
use think\Validate;

/**
 * 通知验证器
 * @package app\admin\validate
 */
class Notice extends Validate{
    //定义验证规则
    protected $rule = [
        'id'             => 'require|number',
        'title' 		 => 'require',
        'status'     	 => 'require|number',
        'content'     	 => 'require',
    ];

    //定义验证提示
    protected $message = [
        'title.require'      => '标题不能为空',
        'status.require'     => '状态不能为空',
        'status.number'      => '状态参数错误',
        'content.require'    => '公告内容不能为空',
    ];

    //定义验证场景
    protected $scene = [
        'add'   => ['title','status','content'],
        'edit'  => ['id','title','status','content'],
    ];
}
?>